package Eyjafjalla.card.status;

import Eyjafjalla.action.CloudReflectionAction;
import Eyjafjalla.action.MakeTempCardInCloudAction;
import Eyjafjalla.action.RetainCloudAction;
import Eyjafjalla.card.AbstractEyjafjallaCard;
import Eyjafjalla.modcore.EyjafjallaTag;
import com.megacrit.cardcrawl.actions.common.DrawCardAction;
import com.megacrit.cardcrawl.actions.common.MakeTempCardInHandAction;
import com.megacrit.cardcrawl.cards.AbstractCard;
import com.megacrit.cardcrawl.characters.AbstractPlayer;
import com.megacrit.cardcrawl.core.CardCrawlGame;
import com.megacrit.cardcrawl.localization.CardStrings;
import com.megacrit.cardcrawl.monsters.AbstractMonster;

public class UnknownCloud_Eyjafjalla extends AbstractEyjafjallaCard {
    public static final String ID = "UnknownCloud_Eyjafjalla";
    private static final CardStrings cardStrings;

    public UnknownCloud_Eyjafjalla(){
        super(ID, cardStrings.NAME,0,cardStrings.DESCRIPTION,CardType.STATUS,CardColor.COLORLESS,CardRarity.SPECIAL,CardTarget.NONE);
        this.exhaust = true;
        this.selfRetain = true;
        tags.add(EyjafjallaTag.RETAIN_EYJAFJALLA);
    }

    @Override
    public AbstractCard makeCopy() {
        return new UnknownCloud_Eyjafjalla();
    }

    @Override
    public void use(AbstractPlayer p, AbstractMonster m) {
        if(this.cardsToPreview!=null){
            if(inCloud()){
                addToBot(new MakeTempCardInCloudAction(this.cardsToPreview));
            }
            else
                addToBot(new MakeTempCardInHandAction(this.cardsToPreview));
        }
    }

    public void setCardPreview(AbstractCard card){
        if(card!=null){
            this.cardsToPreview = card;
            card.drawScale = 0.7F;
            card.angle = 0;
            this.name = card.name + cardStrings.EXTENDED_DESCRIPTION[0];
            rawDescription = cardStrings.EXTENDED_DESCRIPTION[1]+card.name+cardStrings.EXTENDED_DESCRIPTION[2];
            initializeDescription();
        }
    }

    public CardType changeType(){
        if(cardsToPreview!=null){
            return cardsToPreview.type;
        }
        return type;
    }

    @Override
    public AbstractCard makeStatEquivalentCopy() {
        UnknownCloud_Eyjafjalla card = (UnknownCloud_Eyjafjalla) super.makeStatEquivalentCopy();
        if(cardsToPreview!=null)
            card.setCardPreview(this.cardsToPreview.makeStatEquivalentCopy());
        return card;
    }

    @Override
    public void upgrade() {

    }

    @Override
    public void onRetained() {
        addToBot(new RetainCloudAction(this));
    }

    static {
        cardStrings = CardCrawlGame.languagePack.getCardStrings(ID);
    }
}


